<template>
  <div class="login-wrap">
    <div id="mbox">
      <div id="logoDiv">
        <img id="logoImg" src="../assets/logo/logo_w.png" />
        <img id="l_title" src="../assets/logo/l_title2_w.png" />
      </div>
      <br />
      <div class="ms-login">
        <el-form :model="param" :rules="rules" ref="login" label-width="0px" class="ms-content">
          <el-form-item prop="username">
            <el-input v-model="param.username" placeholder="账户"></el-input>
          </el-form-item>
          <el-form-item prop="password">
            <el-input
              type="password"
              placeholder="密码"
              v-model="param.password"
              @keyup.enter.native="submitForm()"
            ></el-input>
          </el-form-item>
          <div class="login-btn">
            <el-button type="primary" @click="submitForm()">登录</el-button>
          </div>
          <p class="login-tips">Tips : 用户名和密码随便填。</p>
        </el-form>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data: function() {
    return {
      param: {
        username: "admin",
        password: "123123"
      }
    };
  },
  methods: {
    submitForm() {
      this.$refs.login.validate(valid => {
        if (valid) {
          this.$message.success("登录成功");
          localStorage.setItem("ms_username", this.param.username);
          this.$router.push("/");
        } else {
          this.$message.error("请输入账号和密码");
          console.log("error submit!!");
          return false;
        }
      });
    }
  }
};
</script>

<style scoped>
@import "../assets/css/main.css";

.login-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  background-image: url(../assets/img/login-bg.jpg);
  background-size: 100%;
}
.ms-title {
  width: 100%;
  line-height: 50px;
  text-align: center;
  font-size: 20px;
  color: #fff;
  border-bottom: 1px solid #ddd;
}
.ms-login {
  width: 350px;
  height: 260px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.3);
  margin: 0 auto;
}
.ms-content {
  padding: 30px 30px;
}
.login-btn {
  text-align: center;
}
.login-btn button {
  width: 100%;
  height: 36px;
  margin-bottom: 10px;
}
.login-tips {
  font-size: 12px;
  line-height: 30px;
  color: #fff;
}

#mbox {
  height: 370px;
  width: 700px;
  position: absolute;
  margin: auto;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

#logoDiv {
  height: 70px;
  line-height: 70px;
  width: 600px;
  margin-bottom: 70px;
  margin: 0 auto;
}

#logoImg,
#l_title {
  width: auto;
  -webkit-user-drag: none;
}

#logoImg {
  height: 40px;
  position: relative;
  top: -15px;
}

#l_title {
  height: 70px;
}
</style>